/**
 * @description:
 * @author: 梅雄
 * @createDate: 2021/12/26
 * @version: 1.0
 * @status: done
 */
package com.xhwl.centiotdata.suppliersystem.eesd.nantouC;

import com.xhwl.common.dto.cent.eesd.EesdC2RequestDTO;
import com.xhwl.common.pojo.ResultJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;

/**
 * 飞渡-碳管理
 * mx
 */
@RestController
public class C2Handler {


    @Autowired
    C2HandlerUtil c2HandlerUtil;

    /**
     * 查询月碳排放量数据
     */
    @PostMapping(value = "/emission/last_month")
    public ResultJson getMonthC2(@RequestPart("dto") EesdC2RequestDTO dto) {
        return ResultJson.success(c2HandlerUtil.getMonthC2());
    }

    /**
     * 查询年碳排放量数据
     */
    @PostMapping(value = "/emission/year")
    public ResultJson getYearC2(@RequestPart("dto") EesdC2RequestDTO dto) {
        return ResultJson.success(c2HandlerUtil.getYearC2());
    }

    /**
     * 查询碳排放曲线数据
     */
    @PostMapping(value = "/emission/curve")
    public ResultJson getC2Discharge(@RequestPart("dto") EesdC2RequestDTO dto) {
        return ResultJson.success(c2HandlerUtil.getC2Discharge(dto.getCurveType()));
    }

    /**
     * 查询碳排放构成数据
     */
    @PostMapping(value = "/emission/formation")
    public ResultJson getC2Build(@RequestPart("dto") EesdC2RequestDTO dto) {
        return ResultJson.success(c2HandlerUtil.getC2Build(dto.getFormationType()));
    }

    /**
     * 查询降碳效果数据
     */
    @PostMapping(value = "/emission/reduction_effect")
    public ResultJson getC2Reduce(@RequestPart("dto") EesdC2RequestDTO dto) {
        return ResultJson.success(c2HandlerUtil.getC2Reduce(dto.getReductionType()));
    }

    /**
     * 查询碳排放指数数据
     */
    @PostMapping(value = "/emission/exponent")
    public ResultJson getC2Index(@RequestPart("dto") EesdC2RequestDTO dto) {
        return ResultJson.success(c2HandlerUtil.getC2Index(dto.getExponentType()));
    }

    /**
     * 查询优化建议数据
     */
    @PostMapping(value = "/emission/suggestion")
    public ResultJson getC2Suggestion(@RequestPart("dto") EesdC2RequestDTO dto) {
        return ResultJson.success(c2HandlerUtil.getC2Suggestion());
    }
}
